#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

template<typename T=int>
inline T read() {
    T x;
    cin >> x;
    return x;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    map<string, int> M;
    int tot = 0;
    for (string word; cin >> word;) {
        M[word]++;
        tot++;
    }
    cout << tot << endl;
    for (auto p:M) {
        cout << p.first << ":" << p.second << endl;
    }

    return 0;
}
//stl map使用 红黑树实现，每个节点为pair<string,int>按键first排序